#pragma once

#include "BaseWidget.h"
#include <qbmessage/include/message_bond.h>
#include <vector>
#include <map>

class RightWidget
	: public BaseWidget
	, public IQpidMessageProcessor
{
	Q_OBJECT
public:
    RightWidget(QWidget* parent = nullptr);
	~RightWidget();

	void RequestUserPermission();
	void RequestCDCAuthority();
	void RequestCSIAuthority();

protected:
	void paintEvent(QPaintEvent* event) override;
	void resizeEvent(QResizeEvent* event) override;

	void setupUi();
	void rightRequestFinish(int funcId, long reqId);
	void printResult(int funcId, int idx, unsigned long useTime, bool bFinish);
	virtual void onTimeout();
	virtual void onIntervalTimeout();

	STDMETHOD_(void, OnResponse) (THIS_ int32_t funcId, const SSAckMsg&);

signals:
	void showResult(int funcId, long reqId);

protected Q_SLOTS:
	void onBtnRequest();
	void onBtnClear();
	void onShowResult(int funcId, long reqId);

private:
	int mTimes = 0;
	int mCurTimes = 0;
	int mUserPermission = 0;
	int mCDCAuthority = 0;
	int mCSIAuthority = 0;
	std::vector<int> vctCheck;
	std::map<int, testCase> mapUserPermission;
	std::map<int, testCase> mapCDCAuthority;
	std::map<int, testCase> mapCSIAuthority;
};
